﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Models.User.WinMoneyModel>" %>

<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	查看用户奖金
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
        <legend>[<%=Model.UserName %>]奖金列表</legend>
        <%=Request["returnurl"] != null ? "<a href='" + Request["returnUrl"] + "' class='a_blue'>&gt;&gt;返回</a>" : ""%>
        <table class="table" width="100%" id="optionform">
            <tr>
                <th>
                    <%=Html.DropDownList("lottery",Model.Lotterys) %>
                </th>
                <% foreach (var item in Model.WinModels)%>
                <% {%>
                <th colspan="2">
                    <%=item.Key %>
                </th>
                <% }%>
            </tr>
            <tr>
                <th>
                    <%=Html.DropDownList("ratio",Model.Ratios) %>
                </th>
                <% foreach (var item in Model.WinModels)%>
                <% {%>
                <th width="100px"><%=Model.UseSiteWinMoney ? "<font color='Red'>站点的</font>" : "用户的"%>奖金</th><th width="100px"><%=Model.UseSiteBackMoneyRatio ? "<font color='Red'>站点的</font>" : "用户的"%>返点</th>
                <% }%>
            </tr>
            <% if(Model.WinMoneys!=null) {foreach (var item in Model.WinMoneys)%>
            <% {%>
            <tr>
                <td ><%=item.Key.Value %></td>
                <% foreach (var win in Model.WinModels)%>
                <% {%>
                <% var item1 = item.Value.First(p => p.WinModelID == win.Value);%>
                <td><%=item1.WinMoney %></td>
                <td class="backmoneyratio" value='<%=item1.BadkMoneyRatio %>'><%=item1.BadkMoneyRatio %>%</td>
                <% }%>
            </tr>
            <% }}%>
        </table>
    </fieldset>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="StyleAndScript" runat="server">
<script type="text/javascript">
    var url = '<%=Url.Action("WinMoney",new{uid="",lottery=""}) %>?';
    var uid = '<%=Request["uid"]!=null?"&uid="+Request["uid"]:"" %>';
    var returnUrl = '<%=Request["returnUrl"]==null?"":"&returnUrl="+Request["returnUrl"] %>';
    var act = '<%=Request["act"]==null?"":"&act="+Request["act"] %>';
    var cont = '<%=Request["cont"]==null?"":"&cont="+Request["cont"] %>';
    $(document).ready(function () {
        $("#optionform select#lottery").change(function () {
            location.href = url + "lottery=" + this.value + uid + returnUrl + act + cont;
        });
        $("#optionform select#ratio").change(function () {
            var _ratio = _ParseDouble(this.value);
            $(".backmoneyratio").each(function () {
                var item = $(this);
                var val = _ParseDouble(item.attr("value"));
                var txt = val.sub(_ratio);
                if (txt < 0)
                    txt = 0;
                item.text(txt + "%");
            });
        }).change();
    });
</script>
</asp:Content>
